package com.tmall.tmall.mapper;

import com.tmall.tmall.pojo.Collect;
import com.tmall.tmall.pojo.CollectRt;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductCollectMapper {
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into collect (uid, pid) VALUE (#{uid},#{pid})")
    void insert(Collect collect);

    void delete(List<Integer> ids);

    @Select("select id,pid from collect where uid=#{uid}")
    List<CollectRt> page(Integer uid);

    @Select("select id from collect where pid=#{pid} and uid=#{uid}")
    Integer getPU(Integer pid, Integer uid);
}
